package com.example.djetpack.livedata

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.Observer
import com.example.djetpack.R

class HiEventBusActivity : AppCompatActivity() {

    private val observer: Observer<String> by lazy {
         Observer {
            Log.d(TAG, "onCreate: $it")
        }
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_hi_event_bus)

        HiEventBus.with<String>("Message").observe(this, {
            Log.d(TAG, "onCreate: $it")
        })

        LiveDataHandler.liveData.observe(this){
            observer
        }
    }

    override fun onDestroy() {
        super.onDestroy()
    }

    companion object {
        private const val TAG = "HiEventBusActivity"
    }
}